import 'dart:ui';
import 'package:flutter/material.dart';
import 'JvtdString.dart';
import 'JvtdStringZh.dart';
import 'JvtdStringBase.dart';
import 'JvtdStringEn.dart';
//字符国际化

class JvtdStringLocalized {
  final Locale locale;

  JvtdStringLocalized(this.locale);

  ///根据不同 locale.languageCode 加载不同语言对应
  ///StringZh都继承了StringBase
  static Map<String, JvtdStringBase> _localizedValues = {
    JvtdString.ZH: new JvtdStringZh(),
    JvtdString.EN: new JvtdStringEn(),
  };

  JvtdStringBase get currentLocalized {
    return _localizedValues[locale.languageCode];
  }

  ///通过 Localizations 加载当前的 String
  ///获取对应的 StringBase
  static JvtdStringLocalized of(BuildContext context) {
    return Localizations.of(context, JvtdStringLocalized);
  }
}
